package com.authority.common;

import org.apache.commons.lang.StringUtils;

public interface AdminConstants {
	String SYSTEM_CODE = "wdk_admin";
	String DEFAULT_PASSWORD = "123456";
	
	String ADMIN = "admin";
	
	int PACK_TIME_DEFAULT_TIME = 1;
	
	int TOLERANCE_TIME_DEFAULT = 0;
	String ALGORITHM_VERSION_DEFAULT="1.0";
	int SET_TOLERANCE_TIME_DEFAULT = 15;
	int IN_TOLERANCE_TIME_DEFAULT = 10;
	
	int SUBAREA_T1_DEFAULT_TIME = 29;
	int SUBAREA_T2_DEFAULT_TIME = 0;
	int SUBAREA_T3_DEFAULT_TIME = 0;
	int SUBAREA_IN_HOLD_TIME_DEFAULT = 5;
	int SUBAREA_SET_HOLD_TIME_DEFAULT =60;

	int QUERY_ALL_IGNORE = -1;

	int CODE_STATUS_ERROR = 500;
	int CODE_STATUS_SUCCESS = 200;

	int CODE_500 = 500;
	int CODE_200 = 200;

	String MSG_STATUS_ERROR = "error";

	String DB_FIELD_SEPARATOR = ";";

	int TEMPLATE_ORDER = 1;
	int TEMPLATE_BATCH = 2;
	int TEMPLATE_FRESH_ORDER = 3;
	int TEMPLATE_FRESH_BATCH = 4;

	int TEMPLATE_FRESH_REFUND_ORDER = 5;
	int TEMPLATE_FRESH_ITEM = 6;
	int TEMPLATE_FRESH_STALL = 7;
	int TEMPLATE_DELIVERY_OPERATOR_KPI = 8;


	String DATA_NOT_EXIST_FOR_FE = "--";
	
	String SALESMAN_ROLE_CODE = "salesmanAuthority";
	

	enum ErrorHandleType {
		// 这里的状态与订单状态对应
		PASS(21, "已接单"), REJECT(22, "已拒单"), UNDO(13, "未接单");

		private int typeNum;
		private String typeDes;

		public int getTypeNum() {
			return typeNum;
		}

		public void setTypeNum(int typeNum) {
			this.typeNum = typeNum;
		}

		public String getTypeDes() {
			return typeDes;
		}

		public void setTypeDes(String typeDes) {
			this.typeDes = typeDes;
		}

		ErrorHandleType(int typeNum, String typeDes) {
			this.typeNum = typeNum;
			this.typeDes = typeDes;
		}

		public static ErrorHandleType getErrorHandleTypeByIndex(int typeNum) throws OutputException {
			ErrorHandleType[] ehtArray = ErrorHandleType.values();
			for (ErrorHandleType eht : ehtArray) {
				if (eht.typeNum == typeNum) {
					return eht;
				}
			}
			throw new OutputException("订单类型异常：当前订单类型，不在异常订单处理范围内，orderStatus=" + typeNum);
		}

		public static ErrorHandleType getErrorHandleTypeByName(String typeName) throws OutputException {
			if (StringUtils.isBlank(typeName)) {
				return null;
			}
			typeName = typeName.trim();

			ErrorHandleType[] ehtArray = ErrorHandleType.values();
			for (ErrorHandleType eht : ehtArray) {
				if (eht.name().equalsIgnoreCase(typeName)) {
					return eht;
				}
			}
			throw new OutputException("订单类型异常：当前订单类型，不在异常订单处理范围内，typeName=" + typeName);
		}
	}

	enum RuleStatus {
		ENABLE(1), DISABLE(0);
		private int sType;

		RuleStatus(int sType) {
			this.sType = sType;
		}

		public int getsType() {
			return sType;
		}

		public void setsType(int sType) {
			this.sType = sType;
		}

		public static RuleStatus getRuleStatusByIndex(int typeNum) {
			RuleStatus[] rsArray = RuleStatus.values();
			for (RuleStatus rs : rsArray) {
				if (rs.sType == typeNum) {
					return rs;
				}
			}
			throw new RuntimeException("获取异常规则失败：当前类型，不在范围内，RuleStatusType=" + typeNum);
		}
	}

	interface SEPARATE_CONSTANT_4_PAGESTREAM {
		public static final String SEP_TYPE_1 = "___";
		public static final String SEP_TYPE_2 = "!!!";
	}

}
